<html>
<head>
<title>SockJS Test</title>
<script src="http://cdn.sockjs.org/sockjs-0.3.js"></script>
</head>
<body>

	<script>
		var sock = new SockJS('http://localhost:8080/receiver');
		sock.onopen = function() {
			console.log('open');
			send("|JOIN|");
		};
		sock.onmessage = function(e) {
			console.log('message - ', e.data);
		};
		sock.onclose = function() {
			console.log('close');
		};

		function send(message) {
			if (sock.readyState == WebSocket.OPEN) {
				console.log("sending message")
				sock.send(message+window.location.href);
			} else {
				console.log("The socket is not open.");
			}
		}
	</script>
	<form onsubmit="return false;">
		<input type="text" name="message" size=100 value="|TEST|AAAAA^1^ABCDE^2^eeeee^3^Hello, World!" /> <input
			type="button" value="Send SockJS data"
			onclick="send(this.form.message.value)" />
	</form>
</body>
</html>